package com.tangcco.lockwell.service.impl;

import com.tangcco.lockwell.domain.Article;
import com.tangcco.lockwell.repository.ArticleMapper;
import com.tangcco.lockwell.repository.BaseMapper;
import com.tangcco.lockwell.service.ArticleService;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
@Service
public class ArticleServiceImpl extends BaseServiceImpl<Article> implements ArticleService {
    public ArticleServiceImpl(BaseMapper<Article> baseMapper) {
        super(baseMapper);
    }
    @Resource
    private ArticleMapper articleMapper;
    //增加
    public int insert(Article article) {
        articleMapper.insert(article);
        return article.getArticleId();

    }
    //根据ID查询
    public Article selectById(Integer id) {
        return articleMapper.selectByPrimaryKey(id);
    }
    //根据Id删除
    public int deleteById(Integer id) {
        return articleMapper.deleteByPrimaryKey(id);
    }
    //修改
    public int updateById(Article article) {
        return articleMapper.updateByPrimaryKeySelective(article);
    }
    //批量添加
    @Override
    public int inserts(Article article) {
        return articleMapper.inserts(article);
    }
}
